package evo.selectors;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import evo.IInstance;

public abstract class HistoricalSelector implements ISelector{
	
	private ISelector _selector;
		
	public HistoricalSelector(ISelector selector){
		this._selector = selector;
	}

	@Override
	public ArrayList<IInstance> select(Map<IInstance, Double> pool, int n) {
		for (IInstance inst : pool.keySet()) {
			double val = this.getVal(inst.getHistoricalFitness());
			pool.put(inst, val);
		}
		return this._selector.select(pool, n);
	}

	protected abstract double getVal(List<Double> historicalFitness);

}
